import junit.framework.TestCase;

public class LiczbaTest extends TestCase {
	private Liczba l = null;
	private String toConv;
	private int base;
	
	public void setUp() throws Exception {
		toConv = "FF";
		base = 16;
		l = new Liczba(toConv, base);
	}
	
	public void test() throws Exception {
		assertEquals("assertEquals failed", l.toString(), "255");
	}
	
	public void testTwo() throws Exception {
		assertTrue("assertTrue failed", l.zapis(10).equals("255"));
	}
	
	//Following test will throw exception
	public void testThree() throws Exception {
		assertFalse("assertFalse failed", l.zapis(8).equals("377")); 
	}
	
	public void testFour() throws Exception {
		assertNotNull("Liczba was not initialized", l);
	}
	
	//Supposed to throw exception at some point
	public void testFive() throws Exception { 
		System.out.println("Number " + l.toString() + " in base:");
		for (int i=2; i<20; i++) {
			try {
				System.out.println(i+": "+l.zapis(i));
			}
			catch (LiczbaException ex) {
				fail("Incorrect base "+i);
			}
		}
	}
}
